Running analyzers during continuous integration
Similar to unit tests and code formatting, analyzers are a tool you want to enforce when modifying a code repository.
Especially, in the context of a team, you want to ensure everybody is adhering to the warnings produced by analyzers.
Command line options
Use the --report
command line argument to produce a sarif report json.
Most CI/CD systems should be able to process this afterwards to capture the reported information by the analyzers.
Example usage:
|
Code root
Use the --code-root
flag to specify the root directory where all reported problems should be relative to.
Typically, this should correspond to your source control (git) repository. Some tooling may require this setting to be accurate for easy navigation to the reported problems.
Example when using MSBuild:
|
GitHub Actions
If you are using GitHub Actions you can easily send the sarif file to CodeQL.
|
You might need to give workflows in your repository the Read and write permissions
for the sarif upload to succeed.
Go to Settings
-> Actions
-> General
and check the Workflow permissions
section.
Sample:
See fsproject/fantomas#2962 for more information.